/*
 * Copyright 2010  One Laptop per Child
 *
 * Host to EC protocol commands
 *
 */
// reserved gap (xo-1/xo-1.5)
#define CMD_GET_API_VERSION              0x08  // out: u8
// reserved gap (xo-1/xo-1.5)
#define CMD_READ_VOLTAGE                 0x10  // out: u16
#define CMD_READ_CURRENT                 0x11  // out: s16
#define CMD_READ_ACR                     0x12  // out: s16
#define CMD_READ_BATT_TEMPERATURE        0x13  // out: u16
// reserved gap (xo-1/xo-1.5)
#define CMD_READ_BATTERY_STATUS          0x15  // out: u8
#define CMD_READ_SOC                     0x16  // out: u8
#define CMD_READ_GAUGE_ID                0x17  // out: u8 * 8
#define CMD_READ_GAUGE_DATA              0x18  // in: u8 addr, out: u8 data
#define CMD_READ_BOARD_ID                0x19  // out: u16 (platform id)
// reserved gap (xo-1/xo-1.5)
#define CMD_READ_BATT_ERR_CODE           0x1f  // out: u8
// reserved gap (xo-1/xo-1.5)
#define CMD_SET_DCON_POWER               0x26  // in: u8
// reserved gap (xo-1/xo-1.5)
// #define CMD_RESET_EC_WITHOUT_POWER_LOSS  0x27  // unimplemented
#define CMD_RESET_EC                     0x28  // none
// reserved gap (xo-1/xo-1.5)
#define CMD_READ_BATTERY_TYPE            0x2c  // out: u8
// reserved gap (xo-1/xo-1.5)
// #define CMD_SET_AUTOWAK                  0x33  // out: u8
// reserved gap (xo-1/xo-1.5)
// #define CMD_SET_EC_WAKEUP_TIMER          0x36  // in: u32, out: ?
#define CMD_READ_EXT_SCI_MASK            0x37  // out: u16
#define CMD_WRITE_EXT_SCI_MASK           0x38  // in: u16
// #define CMD_CLEAR_EC_WAKEUP_TIMER        0x39  // none
// reserved gap (xo-1/xo-1.5)
#define CMD_ENABLE_RUNIN_DISCHARGE       0x3B  // none
#define CMD_DISABLE_RUNIN_DISCHARGE      0x3C  // none
#define CMD_READ_MPPT_ACTIVE             0x3d  // out: u8
#define CMD_READ_MPPT_LIMIT              0x3e  // out: u8
#define CMD_SET_MPPT_LIMIT               0x3f  // in: u8
#define CMD_DISABLE_MPPT                 0x40  // none
#define CMD_ENABLE_MPPT                  0x41  // none
#define CMD_READ_VIN                     0x42  // out: u16
// reserved gap (xo-1/xo-1.5)

// #define RSP_KEYBOARD_DATA                0x48  // ? unimplemented
// #define RSP_TOUCHPAD_DATA                0x49  // ? unimplemented
#define CMD_GET_FW_VERSION               0x4a  // out: u8 * 16
#define CMD_POWER_CYCLE                  0x4b  // none
#define CMD_POWER_OFF                    0x4c  // none
#define CMD_RESET_EC_SOFT                0x4d  // none
// #define CMD_READ_GUAGE_U16               0x4e  // unimplemented
// #define CMD_ENABLE_MOUSE                 0x4f  // unimplemented
#define CMD_JUMP_TO_UPDATE               0x50  // (A1 only)  out: u8
#define CMD_UPDATE_FLASH                 0x51  // (A1 only)
#define CMD_ECHO                         0x52  // in: u8 * 5, out: u8 * 5
#define CMD_GET_FW_DATE                  0x53  // out: u8 * 16
#define CMD_GET_FW_USER                  0x54  // out: u8 * 16
#define CMD_TURN_OFF_POWER               0x55  // none (same as 0x4c)
#define CMD_OLS_READ                     0x56  // out: u16
#define CMD_OLS_SMT_LEDON                0x57  // none
#define CMD_OLS_SMT_LEDOFF               0x58  // none
#define CMD_START_OLS_ASSY               0x59  // none
#define CMD_STOP_OLS_ASSY                0x5a  // none
#define CMD_OLS_SMTTEST_STOP             0x5b  // none
#define CMD_READ_VIN_SCALED              0x5c  // out: u16
#define CMD_READ_BAT_MIN_W               0x5d  // out: u16
#define CMD_READ_BAT_MAX_W               0x5e  // out: u16
#define CMD_RESET_BAT_MINMAX_W           0x5f  // none

#define CMD_READ_LOCATION                0x60  // in: u16 addr, out: u8 data
#define CMD_WRITE_LOCATION               0x61  // in: u16 addr, u8 data
#define CMD_KEYBOARD_CMD                 0x62  // in: u8, out:
#define CMD_TOUCHPAD_CMD                 0x63  // in: u8, out:
#define CMD_GET_FW_HASH                  0x64  // out: u8 * 16
#define CMD_SUSPEND_HINT                 0x65  // in: u8
#define CMD_ENABLE_WAKE_TIMER            0x66  // in: u8
#define CMD_SET_WAKE_TIMER               0x67  // in: 32
#define CMD_ENABLE_WAKE_AUTORESET        0x68  // in: u8
#define CMD_OLS_SET_LIMITS               0x69  // in: u16, u16
#define CMD_OLS_GET_LIMITS               0x6a  // out: u16, u16
#define CMD_OLS_SET_CEILING              0x6b  // in: u16
#define CMD_OLS_GET_CEILING              0x6c  // out: u16
#define CMD_READ_HOST_SUS_PWR		 0x6d  // out: s16
#define CMD_SET_USB_POWER                0x6e  // in: u8
#define CMD_SET_SD2_POWER                0x6f  // in: u8
// #define CMD_SCI_QUERY                0x84  // unimplemented
// #define CMD_EXT_SCI_QUERY                0x85  // unimp (should be 0x43)

#define ERR_BAD_COMMAND                 1

